-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Docs network 2.4 Declarative intent #26954
Conversation
The test
|
Overview | ||
======== | ||
|
||
Consider the case if you wanted to ensure a set of vlans are present on a switch. Although at a high level thia sounds like a simple request, there in a slight nuance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thia -> this
Overview | ||
======== | ||
|
||
Consider the case if you wanted to ensure a set of vlans are present on a switch. Although at a high level thia sounds like a simple request, there in a slight nuance: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thia -> this
|
||
Continuing our vlan example, the following task ensure that vlans ``1``, ``2`` and ``3`` are in the states specified in the task, in `addition` to any existing vlans. | ||
|
||
This task *will not* change any vlans already configured on the switch, apart from the ones specified in the task. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do additive resources just ignore any existing identical items and mark them as "unchanged"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added
Ansible will ensure that the vlans specified in the task exist with the
name
andstate
specified.
Is that clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works
vlan_id: “{{ item.vlan_id }}” | ||
name: “{{ item.name }}” | ||
state: “{{ item.state | default(‘active’) }}” | ||
with_items: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason additive items are added using a for loop rather than with an "additive" keyword like aggregate resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. Originally I wanted to show the different ways of doing things, though that may just confuse the matter.
I've added a FIXME
in the docs.
|
||
This task is very similar to the `additive resource` example above, though with the following differences: | ||
|
||
* The ``purge:`` option (which defaults to `no`) ensure that **only** the specified entries are present. All other entries will be **deleted**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensures
|
||
.. code-block:: yaml | ||
|
||
- name: Enable port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which modules is being used here? This example seems sort of incomplete.
INTERNAL NOTE: Only now that we've explained the problem and given an example should we go into details. | ||
|
||
|
||
Declarative intent modules are designed to provide playbook designers a set of network modules that perform declarative configuration tasks on network devices. This includes the ability to declaratively describe a configuration set. In addition, declarative intent modules will also provide a means for declaratively expressing the intended ephemeral state of configuration resources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some context:
Previous network modules allowed users to update a device by listing out the steps that need to be taking in order to achieve a desired state. Declarative intent modules......
|
||
.. code-block:: yaml | ||
|
||
- name: configure interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there should be a module in this task
The test
|
The test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review comments. Please flesh out the rest of 'declarative_intent' and I will make an edit pass over that as well. Good stuff - thanks @gundalow!
Networking Guides | ||
***************** | ||
|
||
This section explores particular Ansible Networking functionality and use cases in greater depth and provide a more "top down" explanation of some basic features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"provide"->"provides". Also, I'd consider changing "top down explanation" to "an overview of some basic features". We're trying to minimize colloquialisms in the docs that might make future localization work more difficult.
|
||
.. contents:: Topics | ||
|
||
This section explores how and when `Aggregate Resources` can be used within Ansible Networking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't capitalize "Aggregate Resources" unless it's a proper name or a trademark. Re: 'Ansible Networking' - in most cases (unless it's a trademark or proper name) 'networking' shouldn't be capitalized.
|
||
This section explores how and when `Aggregate Resources` can be used within Ansible Networking. | ||
|
||
This document is part of a collection on Networking. The complete list of guides can be found at :ref:`Network Guides <guide_networking>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'networking'
|
||
Consider the case if you wanted to ensure a set of vlans are present on a switch. Although at a high level this sounds like a simple request, there in a slight nuance: | ||
|
||
* Should these vlans be in *addition* to the existing configuration? - *additive* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please spell these out. Something like: "If the vlans are to be in addition to the existing configuration, they are considered additive vlans".
|
||
.. versionadded:: 2.4 | ||
|
||
The ``aggregate:`` option has been added in Ansible 2.4 and is available in certain modules, see the modules documentation to see if the feature is available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semicolon or period and new sentence after "certain modules" please.
|
||
.. warning:: Why does ``purge`` default to ``no``? | ||
|
||
To prevent from accidental deletion ``purge`` is always set to ``no``. This requires playbook writers to add ``purge: yes`` to enable this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comma after deletion.
======================================= | ||
|
||
* What | ||
* Why: Cleaner short hand. Allows you to separate out what's common from what's item specific. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write this section out with full sentences. It reads like shorthand notes.
state: active # override | ||
purge: yes # override | ||
|
||
Become realy power on ``net_interfaces``, mtu, admin_state, description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
purge: yes | ||
|
||
|
||
When would you use aggregate resources with ``purge: true``? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ibid.
|
||
.. contents:: Topics | ||
|
||
This section explores what `Declarative Intent modules` are within the context of Ansible Networking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revisit the capitalization here, as per comments above.
- name: configure vlans neighbor (delete others) | ||
net_vlan: | ||
aggregate: | ||
- 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way of specifying value is not supported. Field under aggregate should be a key value pair.
eg: vlan_id: 1
|
||
* Should we warn if purge & not aggregate | ||
|
||
* Do we want to add ``required_if = [('purge', 'true', ['aggregate'])]`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not be always required. If aggregate is absent and purge is True
it should delete all configured field under specified hierarchy.
enabled: yes | ||
|
||
# Intended state | ||
state: connected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
---------------------- | ||
|
||
All declaritive intent modules support a ``delay:`` option. This represents the amount of time, in seconds, that Ansible will wait after setting declaritive configuration before checking the indended state. This pause is needed to allow the network device being configured to stablise, such as to allow handshake after bring up an interface. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value of delay is 10 seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "The default value is specified in the module's documentation."
Module documentation updated in #30344
- { vlan_id: 6 } | ||
name: reserved_vlan # override | ||
state: active # override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you use aggregate and the normal attribute?
- name: Reserve mgmt vlans
net_vlan:
aggregate:
- { vlan_id: 4 }
- { vlan_id: 5, name: mgmt }
- { vlan_id: 6 }
name: reserved_vlan # override
state: active # override
vlan_id: 5 <--- used in both aggregate and normal attribute
name: not-mgmt
If this is not allowed might be good just to note that. Agreed this is not a useful thing to do but someone could do it and it would good to know what the outcome would be
Based on feedback in Network Contributors Summit in SF I've removed "aggregate" so in 2.4 we can release it as an "undocumented tech preview", this will allow further discussion to be had in the Community regarding how we want to proceed. A backup of the original file can be found at https://gist.github.com/gundalow/c2a4fb51a093a72bc4a380535aa1d835 |
The Core Network team has agreed that we will not add the technical guide for Declarative Intent into 2.4.0 to avoid confusing the end users. Therefore removing 2.4.0 milestone |
Rollback should be used carefully hence all changes should be validated as part of Network CI pipelines for Dev/Test/QA before being promoted to production. |
SUMMARY
New guide_networking section for detailing non-module features:
ISSUE TYPE